<template>
  <div>货币格式化工具</div>
 
  <div>
    <ol>
        <li>货币金额格式化方法是全局方法，使用方法包括 模版调用和vue 实例化调用两种</li>
        <li>货币金额小数点格式化方法和当前{{demoProp.title}}系统语言有关联，使用格式化方法时自动根据语言格式化</li>
        <li>参数说明：currency=》币种格式 *除了rub其他币种默认放在数字后面*  ￥4 723 647 832.0634</li>
        <li>split =》 金额分割  默认值 true  ￥4 723 647 832.0634</li>
        <li>toFixed =》 保留小说  默认值 4位  *不四舍五入！*</li>
        <li>$currencyFormat 方法在 js 中使用不会自动执行，模板中会自动相应</li>
    </ol>
  </div>

  <div>
    {{ $currencyFormat('4723647832.006345',{currency:"cny", split: true,toFixed:4})}}
    <br>
    {{ $currencyFormat('4723647832.006345')}}
    <br>
    {{ $currencyFormat('4723647832.006345',{currency:"usd", split: true })}}
    <br>
    {{ $currencyFormat('4723647832.006345',{currency:"rub", split: true })}}
    <br>
    {{ $currencyFormat('4723647832.006345',{currency:"rub", split: false,toFixed:2 })}}
   
  </div>

  <!-- 页面代码 源码 -->
  <dropWrap key="oreo">
    <pre><code class="language-js">{{ tabsthtm }} </code></pre>
  </dropWrap>
  <!-- 页面代码 源码 -->

  
</template>
    <script lang="ts" setup>
import { ref, onMounted, nextTick,getCurrentInstance } from "vue";
import { demoProps } from "@/stores/modules/merakDemo";
import dropWrap from "../dropWrap.vue";
import Prism from "prismjs";
import "../prism.css";

import { useGlobalStore } from "@/stores/modules/global";
import currency from "@/config/currency";



 
let global=useGlobalStore();
console.log(global)
const demoProp=demoProps();
const value = ref("");
const startTime = ref("");
const endTime = ref("");
let tabsthtm = ref<string>(`
    {{ $currencyFormat('4723647832.006345',{currency:"cny", split: true,toFixed:4})}} //￥4 723 647 832.0634
    <br>
    {{ $currencyFormat('4723647832.006345')}} //4 723 647 832.0634
    <br>
    {{ $currencyFormat('4723647832.006345',{currency:"usd", split: true })}} //$4 723 647 832.0634
    <br>
    {{ $currencyFormat('4723647832.006345',{currency:"rub", split: true })}} //4 723 647 832.0634₽
    <br>
    {{ $currencyFormat('4723647832.006345',{currency:"rub", split: false,toFixed:2 })}} //4723647832.06₽

    js 调用
    const {proxy}=getCurrentInstance(); 
    proxy.$currencyFormat('4723647832.006345',{currency:"rub", split: false,toFixed:2 })  //4723647832.06₽
      
      `);

/* 生命周期 */
onMounted(() => {
  nextTick(() => {
    Prism.highlightAll();
  });
});
</script>
    <style lang="scss" scoped>
</style>